﻿//*  番茄每周福利 *//
//* 作者：50009219*//

var status = 0;
var giftNX = 1000;
var random = java.lang.Math.floor(Math.random() * 4);
var a = "#fEffect/CharacterEff/1114000/1/0#"; //红色六芒星
var b = "#fEffect/CharacterEff/1003271/0/0#";
var c = "#fEffect/CharacterEff/1112905/0/0#"; //篮心
var d = "#fEffect/CharacterEff/1002667/0/0#"; //黄星
var e = "#fEffect/CharacterEff/1003252/1/0#"; //音乐
var g = "#fEffect/CharacterEff/1082565/0/0#"; //饼干兔子
var h = "#fUI/Basic/BtHide3/mouseOver/0#";
var f = "#fEffect/CharacterEff/1112904/2/1#";//彩色五角星
var icon = "#fUI/Basic.img/BtMin2/normal/0#";
var iconEvent = "#fUI/UIToolTip.img/Item/Equip/Star/Star#";
var ttt4 ="#fUI/UIWindow/Quest/icon5/1#";//"+ttt4+"//美化New
var icon2 = "#fEffect/CharacterEff/1082565/2/0#"; 

var ca = java.util.Calendar.getInstance();
var year = ca.get(java.util.Calendar.YEAR); //获得年份
var month = ca.get(java.util.Calendar.MONTH) + 1; //获得月份
var day = ca.get(java.util.Calendar.DATE);//获取日
var hour = ca.get(java.util.Calendar.HOUR_OF_DAY); //获得小时
var minute = ca.get(java.util.Calendar.MINUTE);//获得分钟
var second = ca.get(java.util.Calendar.SECOND); //获得秒
var weekday = ca.get(java.util.Calendar.DAY_OF_WEEK); //获得星期
var time = new Date();
var sjr = time.getDay();
switch (sjr) {
    case 0:
        var xq = "星期日";
        break;
    case 1:
        var xq = "星期一";
        break;
    case 2:
        var xq = "星期二";
        break;
    case 3:
        var xq = "星期三";
        break;
    case 4:
        var xq = "星期四";
        break;
    case 5:
        var xq = "星期五";
        break;
    case 6:
        var xq = "星期六";
        break;
    default:
}
if (hour > 12) {
    hour -= 12;
    var apm = "下午好";
} else {
    var apm = "上午好";
}
function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (status == 0 && mode == 0) {
        cm.dispose();
        return;
    }
    if (mode == 1) {
        status++;
    } else {
        status--;
    }
    if (cm.getMapId() == 180000001) {
        cm.sendOk("很遗憾，您因为违反用户守则被禁止游戏活动，如有异议请联系管理员.")
        cm.dispose();
    } else if (status == 0) {
        var selStr = "#e#r 官方认证勋章：\r\n\r\n";
        selStr += "#n#k" + f + "#r认证可获得勋章#v1142796# #v1142574# !\r\n\r\n#k";
        selStr += "#n#k"+ f +"#r认证要求：#b发送真实生活照片给客服认证\r\n             发送视频跟客服认证\r\n\r\n";
        selStr += "\t\t#e#d#L0#"+ icon +"领取每日#r1500点卷福利\r\n#v5062000#x#r15#k #v5062002#x#r15#k #v5062500#x#r15#k #v4000463#x#r1#k #v4001839#x#r150#k #v2340000#x#r6#k  #v5064000#x#r2#k  #v2048301#x#r2#k  #v5390018#x#r4#k  #l#k#n\r\n\r\n\r\n";
        cm.sendSimple(selStr);
    } else if (status == 1) {
        switch (selection) {
            case 0://奖品
                if (xq = "星期一") {
			/* 是否佩戴或拥有官方认证勋章 */
                   if (cm.getOnlineTime() > 30) {
                     // if (cm.itemQuantity(4000463) || cm.itemQuantity(4000463)  >=1){
                        if (cm.getEventCount("官方认证", 0) < 1) {
                            cm.gainNX(1, giftNX);
                            cm.gainItem(4000463, 1);
                            cm.gainItem(4001839, 150);
                            cm.gainItem(5062000, 15);
                            cm.gainItem(5062002, 15);
                            cm.gainItem(5062500, 15);
                            cm.gainItem(5390018, 4);
                            cm.gainItem(2048301, 2);
                            cm.gainItem(5064000, 2);
                            cm.gainItem(2340000, 6)
               cm.worldSpouseMessage(0x11,"『官方认证』 "+ cm.getChar().getName() +"  领取了官方认证福利，获得了丰厚的奖励！");
                    cm.sendOk("\t\t\t\r\n\r\n#e#r恭喜您！你已领取了每日福利礼包！！");
                            cm.setEventCount("官方认证", 1);
                            cm.dispose();
                        } else {
                            cm.sendOk("\t\t\t\r\n\r\n#e#r您本日已领取过奖励，请明日再来。");
                            cm.dispose();
                        }
                    } else {
                        cm.sendOk("\t\t\t\r\n\r\n#e#r在线时间未达到30分钟，无法领取奖励。");
                        cm.dispose();
                    }
                } else {
                    cm.sendOk("\t\t\t\r\n\r\n#e#r脚本出错，请联系管理员。");
                    cm.dispose();
                }
        }
    }
}